<!DOCTYPE html>

<style>
    .box {
        width: 1100px;
        height: 500px;
        margin: 0 auto;
    }
</style>
<html>

<body>
    <div class="box">
        <!-- <iframe name="iframe" width="100%" height="100%" src="http://www.baidu.com" ></iframe> -->
        <iframe name="iframe" width="100%" height="100%" src="1.html"></iframe>
    </div>
    <script>
        // function imitateClick(oElement, iClientX, iClientY) {
        //     var oEvent;
        //     if (document.createEventObject) { //For IE
        //         oEvent = document.createEventObject();
        //         oEvent.clientX = iClientX;
        //         oEvent.clientY = iClientY;
        //         oElement.fireEvent("onclick", oEvent);
        //     } else {
        //         oEvent = document.createEvent("MouseEvents");

        //         oEvent.initMouseEvent("click", true, true, document.defaultView, 0, 0, 0,iClientX, iClientY );/*, false, false, false, false, 0, null*/
        //         oElement.dispatchEvent(oEvent);
        //     }
        // }



        var body = document.body;
        // body.onclick = function (event) {
        //     alert("clicked at (" + event.clientX + "," + event.clientY + ")");
        // };
        // imitateClick(body, 810, 20);


        body.addEventListener('click', function (e) {
            alert('我是本页面的')
            console.log(e)
        })

        setTimeout(function () {
            var event = new MouseEvent('load', {
                bubbles: true,
                cancelable: true,
                isTrusted: true,
                view: window,
                clientX: 500,
                clientY: 70,
                button: 0
            })

            body.dispatchEvent(event);

        }, 2000);
    </script>
</body>

</html>

<!--JS 点击某个XY坐标难做吗  -->